<?php
$childmod = get_get("childmod");
if(!$childmod) $childmod="zone";
if (! isAjaxRequest()) {
    global $_G;

    $uid = getSessionUid();
    $owneruid = get_get("uid");
    if ($owneruid == "") {
        $owneruid = $uid;
    }
    $op = get_get("op");
    global $isOwner;
    $isOwner = $owneruid == $uid;
    global $profile;
    $profile = getProfile($owneruid);
    if (! $profile) {
        if (! $isOwner) {
            printMessage("error", "你的请求无效，该用户不存在或家园被锁定或禁止你访问");
            die();
        }
        global $_GCONFIG;
        $profile = $_GCONFIG["user"]["default"]["profile"];
    }
    if (! allowVisit($uid, $owneruid)) {
        printMessage("error", "你的请求无效，该用户不存在或家园被锁定或禁止你访问");
        die();
    }
    $data = array();
    if (! $isOwner)
        $data["call"] = $profile["gender"] == 1 ? "她的" : "他的";
    else
        $data["call"] = "我的";
    $data["profile"] = $profile;
    $data["isOwner"] = $isOwner;
    $data["noticeamount"] = $_G["noticeamount"];
    $data["notreadlmamount"] = $_G["notreadlmamount"];
    if ($isOwner) {
        $data["classdata"] = $_G["classdata"];
    }
    if ($op == "detial_profile") {
        $data["request"] = "index.php?mod=home&childmod=home&ajax=true&op=detial_profile&uid=$uid";
    }
    if ($op == "activity") {
        $aid = get_get("aid");
        $data["request"] = "index.php?mod=home&childmod=home&ajax=true&op=activity&aid=$aid";
    }
    if ($op == "listActivities") {
        $aid = get_get("aid");
        $data["request"] = "index.php?mod=home&childmod=home&ajax=true&op=listActivities";
    }
    if ($op == "listOwnActivities") {
        $aid = get_get("aid");
        $data["request"] = "index.php?mod=home&childmod=home&ajax=true&op=listOwnActivities&uid=$uid";
    }
    setSetting("home_head", $data);

    if ($childmod == "notices") {
        if (! $isOwner) {
            printMessage("error", "你的请求无效，无权访问他人家园的提醒，如果您是管理员，需要查询他的提醒，请进入管理面板。");
            die();
        }
        loadTemp("home/home_notices.php");
        die();
    }
    if ($childmod == "zone") {
        loadTemp("home/home_zone.php");
        die();
    }
    if ($childmod == "setting") {
        if (! $isOwner) {
            printMessage("error", "你的请求无效，无权访问他人家园的设置，如果您是管理员，需要修改该人的家园设置，请进入管理面板。");
            die();
        }
        loadTemp("home/home_personal_settings.php");
        die();
    }
    printMessage("error", "无效的请求，请联系服务器管理员");
    die();
} else {
    if ($childmod == "setting") {
        require_once 'settings_handle.php';
    }
    if ($childmod == "home") {
        require_once 'home_handle.php';
    }
    if ($childmod = "notice") {
        require_once 'notice_handle.php';
    }
}

?>